-
Notifications
You must be signed in to change notification settings - Fork 583
Reuse buffers in ServerMessage<BsatnFormat>
#2911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: centril/execute-plan-no-temp-vecs
Are you sure you want to change the base?
Reuse buffers in ServerMessage<BsatnFormat>
#2911
Conversation
f4b0fb9
to
ed80830
Compare
Can you make the first commit its own independent PR? |
Will do 👍 |
0e9622d
to
6b90886
Compare
5f2394e
to
b961e78
Compare
b961e78
to
bbeec32
Compare
a7aa61a
to
b0cc2d4
Compare
fa008fb
to
9411e5e
Compare
b0cc2d4
to
f3be26f
Compare
f3be26f
to
f112436
Compare
This is now a fairly small PR based atop another fairly small PR github.com//pull/2918. |
f112436
to
88cb22c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved as a code owner, and no objections otherwise, though I'd still like review from @joshua-spacetime re: the metrics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we wait for #2866 to land first, this doesn't have to be a pool, it can just be a thread local buffer. I think I'd prefer we wait for that in order to simplify things even further.
For a thread local to work, you'd need to move |
6271604
to
c134d82
Compare
Description of Changes
Fixes #2824.
Defines a global pool
BsatnRowListBuilderPool
which reclaims the buffers of aServerMessage<BsatnFormat>
and which is then used when building newServerMessage<BsatnFormat>
s.Notes:
BsatnRowListBuilderPool
reports the same kind of metrics to prometheus asPagePool
does.BsatnRowListBuilder
now works in terms ofBytesMut
.fn to_bsatn_extend
is redefined to be capable of dealing withBytesMut
as well asVec<u8>
.ConsumeEachBuffer
is defined fromServerMessage<BsatnFormat>
and down to extract buffers.<ServerMessage<_> as ConsumeEachBuffer>::consume_each_buffer(...)
is then called inmessages::serialize(...)
just after bsatn-encoding the entire message and before any compression is done. This is the place where the pool reclaims buffers.Benchmarks
Benchmark numbers vs. master using
cargo bench --bench subscription -- --baseline subs
on i7-7700K, 64GB RAM:The improvements in
footprint-scan
are mostly thanks to #2918, but 7 ms of the improvements here are thanks to the pool. The improvements tofull-scan
should be only thanks to the pool.API and ABI breaking changes
None
Expected complexity level and risk
2?
Testing
Pool<T>
also apply toBsatnRowListBuilderPool
.